--小飞飞啊
--qq：771501117
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)
local cl = reaper.ColorToNative(255, 255, 0)|0x1000000-- 设置编组颜色为黄色
local num = reaper.CountSelectedMediaItems(0)
if num > 0 then
    local id = math.random(1, 32000)
    for i = 0, num - 1 do
        local it = reaper.GetSelectedMediaItem(0, i)
        reaper.SetMediaItemInfo_Value(it, "I_GROUPID", id)
    end
    for i = 0, num - 1 do
        local it = reaper.GetSelectedMediaItem(0, i)
        reaper.SetMediaItemInfo_Value(it, "I_CUSTOMCOLOR", cl)
    end
end
reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
reaper.Undo_EndBlock("06.小飞飞啊_音频编组（黄色）", -1)
